import React, { PureComponent } from 'react'
import { connect } from 'react-redux'
import { Redirect } from 'react-router-dom'

class Write extends PureComponent {

  render() {
    const { isLogin } = this.props

    if (isLogin) {
      return (
        <div>写文章页面</div>
      )
    } else {
      return <Redirect to='/login' />
    }
  }
}

const mapState = (state) => {
  return {
    isLogin: state.getIn(['login', 'islogin'])
  }
}

export default connect(mapState, null)(Write)
